/*
 * Copyright (c) 2009, Jan Pastor. All Rights Reserved.
 */

package sk.jp.imageio.jpeg;

import java.util.Set;
import java.util.LinkedHashSet;

import sk.jp.imageio.jpeg.metadata.Tag;
import sk.jp.imageio.jpeg.metadata.Rating;
import sk.jp.imageio.jpeg.metadata.Info;

/**
 * Base implementation of {@link JpegImage}.
 */
public abstract class AbstractJpegImage implements JpegImage {

    private final Set<Tag> tags;
    private final Rating rating;
    private final Info info;

    //----------------------------------------------------------------------

    protected AbstractJpegImage(Info info) {
        if(info == null) throw new NullPointerException("Parameter info is null");

        this.info = info;

        tags = new LinkedHashSet<Tag>();
        rating = new Rating();
    }

    //----------------------------------------------------------------------

    public Set<Tag> getTags() {
        return tags;
    }

    public Rating getRating() {
        return rating;
    }

    public Info getInfo() {
        return info;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append("AbstractJpegImage");
        sb.append("{tags=").append(tags);
        sb.append(", rating=").append(rating);
        sb.append(", info=").append(info);
        sb.append('}');
        return sb.toString();
    }

}
